package com.exadel.googleregistrator.bo.impl;

import com.exadel.googleregistrator.bo.AccountBO;
import com.exadel.googleregistrator.dao.AccountDAO;
import com.exadel.googleregistrator.entities.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Администратор
 * Date: 14.08.12
 * Time: 15:09
 */
@Service
public class AccountBoImpl implements AccountBO {

    @Autowired
    private AccountDAO dao;

    @Override
    public Account find(int id) {
        return dao.readAccount(id);
    }

    @Override
    public List getAll() {
        return dao.getAccounts();
    }

    @Override
    public void create(Account account) {
        dao.createAccount(account);
    }

    @Override
    public void delete(Account account) {
        dao.deleteAccount(account);
    }

    @Override
    public void update(Account account) {
        dao.updateAccount(account);
    }

    public AccountDAO getDao() {
        return dao;
    }

    public void setDao(AccountDAO dao) {
        this.dao = dao;
    }
}
